package com.itheima.shengxiao3;

import com.itheima.shengxiao2.Desk;

import java.util.concurrent.ArrayBlockingQueue;

public class Demo01 {

    public static void main(String[] args) throws InterruptedException {
        ArrayBlockingQueue<String> queue = new ArrayBlockingQueue<String>(3);
        Ganfanren ganfanren = new Ganfanren(queue);
        Thread t1 = new Thread(ganfanren);
        t1.setName("干饭人");
        Ganfanren ganfanren2 = new Ganfanren(queue);
        Thread t3 = new Thread(ganfanren2);
        t1.setName("干饭人2");
        Ganfanren ganfanren3 = new Ganfanren(queue);
        Thread t4 = new Thread(ganfanren3);
        t1.setName("干饭人3");
        Ganfanren ganfanren4 = new Ganfanren(queue);
        Thread t5 = new Thread(ganfanren4);
        t1.setName("干饭人4");
        Ganfanren ganfanren5 = new Ganfanren(queue);
        Thread t6 = new Thread(ganfanren5);
        t1.setName("干饭人5");
        Chuzi chuzi = new Chuzi(queue);
        Thread t2 = new Thread(chuzi);
        t2.setName("厨子");
        t2.start();
        Thread.sleep(2000);
        t1.start();
        t3.start();
        t4.start();
        t5.start();
        t6.start();


    }
}
